package com.falm.cli.example;

import picocli.CommandLine;
import picocli.CommandLine.Option;

import java.util.concurrent.Callable;

/**
 * 实现交互式输入
 * @author Administrator
 */
@CommandLine.Command(name = "Login", version = "Login 1.0", mixinStandardHelpOptions = true, subcommands = {ASCIIArt.class})
public class Login implements Callable<Integer> {
    @Option(names = {"-u", "--user"}, description = "User name")
    String user;

    @Option(names = {"-p", "--password"}, description = "Passphrase", interactive = true, echo = true, prompt = "请输入密码：")
    String password;

    public Integer call() throws Exception {
        System.out.println("password = " + password);
        return 0;
    }

    public static void main(String[] args) {
        new CommandLine(new Login()).execute("-u", "user123", "-p");
    }
}
